{% extends 'base.html' %}
{% block title %}
    <a class="navbar-brand" href="#"> {{ staff.username }} 的家庭成员及社会关系信息 </a>
{% endblock %}
{% block write %}
    <li>
    <a href="{{ url_for('write_staff_relation',userID = staff.userID) }}" class="btn btn-simple btn-info btn-icon like" data-toggle="dropdown">
        添加关系信息
    </a>
    </li>
{% endblock %}
{% block content %}
    <div class="content">
		{% if staff_relations == [] %}
			<h4 class="title">{{ staff.username }} 暂无家庭成员及社会关系信息</h4>
		{% else %}
			<h4 class="title">{{ staff.username }} 的家庭成员及社会关系信息</h4>
		{% endif %}

        <div class="toolbar">

            <!--        Here you can write extra buttons/actions for the toolbar              -->
        </div>
    <div class="material-datatables">
        <table id="datatables" class="table table-striped table-no-bordered table-hover"
               style="width:100%;cellspacing:0">
            <thead>
            <tr>
                <th>姓名</th>
                <th>关系</th>
                <th>姓名</th>
                <th>单位</th>
                <th>职位</th>
                <th>电话号码</th>
                <th class="disabled-sorting text-right">操作</th>
            </tr>
            </thead>

            <tbody>
            {% for staff_relation in staff_relations %}
                <tr>
                    <td>{{ staff.username }}</td>
                    <td>{{ staff_relation.relation }}</td>
                    <td>{{ staff_relation.name }}</td>
                    <td>{{ staff_relation.company }}</td>
                    <td>{{ staff_relation.position }}</td>
                    {% if staff_relation.phone == None %}
                    <td></td>
                    {% else %}
                    <td>{{ staff_relation.phone }}</td>
                    {% endif %}
                    <td class="text-right">
                        <form  method="post" action="{{ url_for('delete_staff_relation',userID=staff.userID,id = staff_relation.id) }}">
                        <a href="{{ url_for('change_staff_relation',userID=staff.userID,id = staff_relation.id) }}"
                           class="btn btn-simple btn-info btn-icon like">修改</a>
                            <input name="delete" type="submit" value="删除" onclick="return confirm('确认删除此关系？')" class="btn btn-simple btn-danger btn-icon remove">
                        </form>
                    </td>
                </tr>
            {% endfor %}
            </tbody>

        </table>
    </div>
</div>
{% endblock %}